package com.sk.seckilldemo.controller;

import com.sk.seckilldemo.entity.ClassesInfo;
import com.sk.seckilldemo.service.ClassesService;
import com.sk.seckilldemo.util.Response;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 商品分类管理控制器接口API
 * e4glet
 * 2025年7月1日
 * */
@RestController
@CrossOrigin
@RequestMapping("/classes")
@RequiredArgsConstructor
public class ClassesController {
    private final ClassesService classesService;

    /**
     * 添加商品分类
     * */
    @PostMapping("/add")
    public Response addClasses(@RequestBody ClassesInfo classes){
        return classesService.addClasses(classes);
    }

    /**
     * 更新商品分类
     * */
    @PostMapping("/update")
    public Response modifyClasses(@RequestBody ClassesInfo classes){
        return classesService.modifyClasses(classes);
    }

    /**
     * 删除商品分类
     * */
    @PostMapping("/delete")
    public Response deleteClasses(@RequestBody ClassesInfo classes){
        return classesService.deleteClasses(classes);
    }


    /**
     * 查询商品分类
     * */
    @GetMapping("/list")
    public Response getClasses(){
        return classesService.getClasses();
    }
}
